
/* Generated by Interface Builder */

#import <string.h>
#import "Param.h"

@implementation Param

- init:motherUgen:(NXPoint *)theOffset
// create a parameter for the unit generator
{
	ugen = motherUgen;  
	offset.x = theOffset->x;
	offset.y = theOffset->y;
	strcpy(value,"1");
	connectedParam = nil;
	return self;
}

- move:(NXPoint *)newloc
// move the parameter to the new location after unit generator placed somewhere in view
{
	location.x = newloc->x+offset.x;
	location.y = newloc->y+offset.y;
	rectangle.origin.x = location.x;
	rectangle.origin.y = location.y;
	rectangle.size.width = PARAM_SIZE;
	rectangle.size.height = PARAM_SIZE;
	drawPoint.x = location.x + 10;
	drawPoint.y = location.y + 10;
	return self;
}

- (NXRect *)getRect
{
	return &rectangle;
}

- (NXPoint *)getDrawPoint
{
	return &drawPoint;
}

- setConnectedParam:param
{
	connectedParam = param;
	return self;
}

- getConnectedParam
// get the parameter that this parameter is connected to
{
	return connectedParam;
}

- setValue:(char *)val
// set the value stored 
{
	strcpy(value,val);
	return self;
}

- (char *)getValue
// get the value stored in the parameter
{
	return value;
}

- getUgen
// get the unit generator this parameter is part of
{
	return ugen;
}

- setTitle:(char *)tit
// set the title of the parameter (for the parameter-setting form field)
{
	strcpy(title,tit);
	return self;
}

- (char *)getTitle
// get the title of the parameter (for the parameter-setting form field)
{
	return title;
}


@end
